<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCulturalHeritagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cultural_heritages', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('自增ID');

            $table->string('title', 300)->comment('标题');
            $table->string('desc', 300)->nullable()->comment('简介');
            $table->string('image', 500)->comment('图片');
            $table->text('author')->comment('传承人');
            $table->string('content', 2000)->comment('内容');
            $table->unsignedTinyInteger('type')->default(1)->comment('类型');

            $table->string('level', 200)->nullable()->comment('非遗级别');
            $table->boolean('is_home')->default(0)->comment('是否首页 1:是 0:否');
            $table->string('cover', 500)->nullable()->comment('首页封面图');
            $table->unsignedTinyInteger('sort')->default(0)->comment('排序');

            $table->unsignedBigInteger('publisher_uid')->comment('发布者uid')->index();

            $table->timestamps();
            $table->softDeletes();

            $table->engine = 'InnoDB';

        });
        DB::statement("alter table `cultural_heritages` comment'非遗展示表'");

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cultural_heritages');
    }
}
